﻿namespace ProblemsSet
{
    public class Problem_48 : BaseProblem
    {
        public override object GetResult()
        {
            const int mx = 1000;
            const int digits = 10;

            var res = "0";
            long tmp = 0;

            for(var i = 1; i <= mx; i++)
            {
                var val = i.ToString();
                for (var j = 1; j < i; j++)
                {
                    val = MathLogic.MultipleString(val, i, out tmp, digits);
                }
                res = MathLogic.SummString(res, val, digits);
            }
            return res;
        }

        public override string Problem
        {
            get
            {
                return @"The series, 11 + 22 + 33 + ... + 1010 = 10405071317.

Find the last ten digits of the series, 11 + 22 + 33 + ... + 10001000.";
            }
        }

        public override bool IsSolved
        {
            get
            {
                return true;
            }
        }

        public override object Answer
        {
            get
            {
                return 9110846700;
            }
        }
    }
}
